package com.zmn.plat.manager.dictionary;

import com.zmn.common.dictionary.DictModel;
import com.zmn.plat.common.enums.PilotConfigEnum;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述: 渠道试点字典类
 *
 * @updater wangjie 补全注释
 * @since 2019/9/6
 **/
public class OnePriceDict {

    public static List<DictModel> getPayTypeList() {
        List<DictModel> payTypeList = new ArrayList<>();
        payTypeList.add(new DictModel(1, "下单时必须支付"));
        payTypeList.add(new DictModel(2, "必须下单后支付"));
        payTypeList.add(new DictModel(3, "两种均支持"));
        return payTypeList;
    }

    public static List<DictModel> getPriceDiscountList() {
        List<DictModel> payTypeList = new ArrayList<>();
        payTypeList.add(new DictModel(2, "线上支付9折(定金除外)"));
        payTypeList.add(new DictModel(1, "无"));
        return payTypeList;
    }

    public static List<DictModel> getStatusList() {
        List<DictModel> payTypeList = new ArrayList<>();
        payTypeList.add(new DictModel(2, "启用"));
        payTypeList.add(new DictModel(1, "停用"));
        return payTypeList;
    }

    /**
     * 描述: 是否设置定金字典
     *
     * @return java.util.List<com.zmn.common.dictionary.DictModel>
     * @author wangjie
     * @since 2019/9/6
     **/
    public static List<DictModel> getDepositList() {
        List<DictModel> depositList = new ArrayList<>();
        depositList.add(new DictModel(2, "设置"));
        depositList.add(new DictModel(1, "不设置"));
        return depositList;
    }

    /**
     * 试点类型：1线上支付，2计价器（故障维度），3三日退试点，4 优惠限制，5 维修机器人
     *
     * @return List<DictModel>
     * @author xiangjunming
     * @since 2019/11/19
     */
    public static List<DictModel> getTypeList() {

        List<DictModel> typeList = new ArrayList<>();
        PilotConfigEnum [] pilotConfigEnums = PilotConfigEnum.values();
        for (PilotConfigEnum p : pilotConfigEnums) {
            typeList.add(new DictModel(p.getType(), p.getExplain()));
        }
        return typeList;
    }

    /**
     * 试点类型：1线上支付，2计价器（故障维度），3三日退试点，4 优惠限制，5 维修机器人
     *
     * @return
     * @author xiangjunming
     * @since 2019/11/19
     */
    public static String getType(Integer type){

        if(type == null){
            return "";
        }
        PilotConfigEnum pilotConfigEnum = PilotConfigEnum.getPilotConfigEnum(type);
        if (pilotConfigEnum != null) {
            return pilotConfigEnum.getExplain();
        } else {
            return "";
        }
    }

    public static String getPayType(Integer payType) {
        if(payType == null){
            return "";
        }
        switch(payType) {
            case 1:
                return "下单时必须支付";
            case 2:
                return "必须下单后支付";
            case 3:
                return "两种均支持";
            default:
                return "";
        }
    }

    public static String getPriceDiscount(Integer priceDiscount) {
        if(priceDiscount == null){
            return "";
        }
        switch(priceDiscount) {
            case 2:
                return "线上支付9折(定金除外)";
            case 1:
                return "无";
            default:
                return "";
        }
    }

    public static String getStatus(int name){
        switch(name) {
            case 1:
                return "否";
            case 2:
                return "是";
            default:
                return "";
        }
    }
}
